package com.mt.roll.core.dal.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 登录会话表，存放在线用户信息
 * </p>
 *
 * @author mt
 * @since 2021-12-30
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_login_session")
public class LoginSession extends Model<LoginSession> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，自增
     */
      @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 会话ID
     */
    @TableField("session_id")
    private String sessionId;

    /**
     * 账号ID
     */
    @TableField("account_id")
    private Long accountId;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 公司ID
     */
    @TableField("corp_id")
    private Long corpId;

    /**
     * 医院ID
     */
    @TableField("hospital_id")
    private Long hospitalId;

    /**
     * 组织ID
     */
    @TableField("org_id")
    private Long orgId;

    /**
     * 账号
     */
    @TableField("account")
    private String account;

    /**
     * 手机号
     */
    @TableField("mobile")
    private String mobile;

    /**
     * 用户名称
     */
    @TableField("user_name")
    private String userName;

    /**
     * 公司名称
     */
    @TableField("corp_name")
    private String corpName;

    /**
     * 医院名称
     */
    @TableField("hospital_name")
    private String hospitalName;

    /**
     * 组织名称，存放平台组织或者医院科室或者公司门店
     */
    @TableField("org_name")
    private String orgName;

    /**
     * 用户类型：1、平台用户，2、公司用户，3、医院用户，4、患者
     */
    @TableField("user_type")
    private Integer userType;

    /**
     * 应用类型：1、pc，2、app，3、wechat，4、miniapp
     */
    @TableField("app_type")
    private Integer appType;

    /**
     * 应用编码：暂未使用
     */
    @TableField("app_code")
    private Integer appCode;

    /**
     * 登录类型：1、自主登录，2、漫游登录
     */
    @TableField("login_type")
    private Integer loginType;

    /**
     * 登录时间
     */
    @TableField("login_time")
    private LocalDateTime loginTime;

    /**
     * 设备类型
     */
    @TableField("device_class")
    private String deviceClass;

    /**
     * 设备名称
     */
    @TableField("device_name")
    private String deviceName;

    /**
     * 设备品牌
     */
    @TableField("device_brand")
    private String deviceBrand;

    /**
     * 操作系统
     */
    @TableField("os")
    private String os;

    /**
     * 浏览器
     */
    @TableField("browser")
    private String browser;

    /**
     * 国家
     */
    @TableField("country")
    private String country;

    /**
     * 省份
     */
    @TableField("province")
    private String province;

    /**
     * 地市
     */
    @TableField("city")
    private String city;

    /**
     * 区县
     */
    @TableField("county")
    private String county;

    /**
     * 地址
     */
    @TableField("address")
    private String address;

    /**
     * 精度
     */
    @TableField("lng")
    private String lng;

    /**
     * 纬度
     */
    @TableField("lat")
    private String lat;

    /**
     * 网络服务提供商
     */
    @TableField("isp")
    private String isp;

    /**
     * IP地址
     */
    @TableField("ip")
    private String ip;

    /**
     * 用户代理，存放用户登录时客户端信息
     */
    @TableField("user_agent")
    private String userAgent;

    /**
     * ip转地址状态：0、未获取，1、登录地址获取成功，2、退出地址获取成功，-1、登录地址获取失败，-2、退出地址获取失败
     */
    @TableField("ip_to_address_status")
    private Integer ipToAddressStatus;

    /**
     * ip转地址次数，最多转换3次，三次失败修改状态为失败（-1、-2）
     */
    @TableField("ip_to_address_count")
    private Integer ipToAddressCount;

    /**
     * ip转地址时间
     */
    @TableField("ip_to_address_time")
    private LocalDateTime ipToAddressTime;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 创建人
     */
    @TableField("creator")
    private Long creator;

    /**
     * 创建人姓名
     */
    @TableField("creator_name")
    private String creatorName;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    @TableField("updater")
    private Long updater;

    /**
     * 更新人姓名
     */
    @TableField("updater_name")
    private String updaterName;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 版本号
     */
    @TableField("version")
    @Version
    private Integer version;


    public static final String ID = "id";

    public static final String SESSION_ID = "session_id";

    public static final String ACCOUNT_ID = "account_id";

    public static final String USER_ID = "user_id";

    public static final String CORP_ID = "corp_id";

    public static final String HOSPITAL_ID = "hospital_id";

    public static final String ORG_ID = "org_id";

    public static final String ACCOUNT = "account";

    public static final String MOBILE = "mobile";

    public static final String USER_NAME = "user_name";

    public static final String CORP_NAME = "corp_name";

    public static final String HOSPITAL_NAME = "hospital_name";

    public static final String ORG_NAME = "org_name";

    public static final String USER_TYPE = "user_type";

    public static final String APP_TYPE = "app_type";

    public static final String APP_CODE = "app_code";

    public static final String LOGIN_TYPE = "login_type";

    public static final String LOGIN_TIME = "login_time";

    public static final String DEVICE_CLASS = "device_class";

    public static final String DEVICE_NAME = "device_name";

    public static final String DEVICE_BRAND = "device_brand";

    public static final String OS = "os";

    public static final String BROWSER = "browser";

    public static final String COUNTRY = "country";

    public static final String PROVINCE = "province";

    public static final String CITY = "city";

    public static final String COUNTY = "county";

    public static final String ADDRESS = "address";

    public static final String LNG = "lng";

    public static final String LAT = "lat";

    public static final String ISP = "isp";

    public static final String IP = "ip";

    public static final String USER_AGENT = "user_agent";

    public static final String IP_TO_ADDRESS_STATUS = "ip_to_address_status";

    public static final String IP_TO_ADDRESS_COUNT = "ip_to_address_count";

    public static final String IP_TO_ADDRESS_TIME = "ip_to_address_time";

    public static final String REMARK = "remark";

    public static final String CREATOR = "creator";

    public static final String CREATOR_NAME = "creator_name";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATER = "updater";

    public static final String UPDATER_NAME = "updater_name";

    public static final String UPDATE_TIME = "update_time";

    public static final String VERSION = "version";

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
